package parse_and_index.model;

import java.io.Serializable;

public class Page implements Comparable<Object>, Serializable {
	  private static final long serialVersionUID = 7876671714028991736L;
	  private int			   pageNumber;
	  private int			   hitCount;

	  public Page(final int pageNum) {
			pageNumber = pageNum;
			hitCount = 1;
	  }

	  public int getHitCount() {
			return hitCount;
	  }

	  public void setHitCount(final int hitCount) {
			this.hitCount = hitCount;
	  }

	  public void incrementHitCount() {
			hitCount++;
	  }

	  public int getPageNumber() {
			return pageNumber;
	  }

	  public void setPageNumber(final int pageNumber) {
			this.pageNumber = pageNumber;
	  }

	  @Override
	  public String toString() {
			return pageNumber + "-" + hitCount;
	  }

	  @Override
	  public int compareTo(final Object p) {
			final Page page = (Page) p;
			if (page.getHitCount() > hitCount) { return -1; }
			if (page.getHitCount() < hitCount) { return 1; }
			return 0;
	  }
}